Error: Call to a member function addEagerConstraints() on null in file

43

Error: Call to a member function addEagerConstraints() on null in file -

in your relationship you are missing return statement, 
please follow the following example

public function user() {
        $this->belongsTo(User::class,'user_id','id');
}

to 
  
public function user() {
        return $this->belongsTo(User::class,'user_id','id');
    }

Comments

Submit
0 Comments